#include <iostream>

class A
{
public:
	A() = default;
	virtual ~A() = default;
	virtual void fun() = 0;
	int a = {0};
};

class B : public virtual A
{
public:
	B() = default;
	virtual ~B() = default;
	virtual void fun() { std::cout << "B::fun()" << std::endl; }
	int b = {2};
};


class C : public virtual A
{
public:
	C() = default;
	virtual ~C() = default;
	//virtual void fun() { std::cout << "C::fun()" << std::endl; }
	int c = {3};
};

class D : public B, public C
{
public:
	D() = default;
	virtual ~D() = default;
	int d = {4};
};

int main()
{
	D d;
	std::cout << sizeof(d) << std::endl;
	std::cout << typeid(d).hash_code() << std::endl;
	B& c = dynamic_cast<B&>(d);
}


